package com.too.demo.controller;

import com.too.demo.config.RedisConfiguration;
import com.too.demo.message.MessageProducer;
import com.too.demo.vo.QueueVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.stream.Record;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试接口
 *
 * @author ouyf
 * @date 2024/9/5 14:51
 * <p>
 * Copyright (c) Siemens Mobility TBDS 2024, All Rights Reserved, Confidential
 */
@RestController
public class RedisMqController {

    @Autowired
    private MessageProducer producer;

    @Autowired
    private RedisConfiguration redisConfiguration;

    @GetMapping("producer")
    public String producer(@RequestParam String body) {
        producer.sendMessage("RARSP:REPORT:READ:VS", "test", body);
        return "ok";
    }

    @GetMapping("producer/queue")
    public String producerQueue(@RequestParam String body) {
        QueueVO content = new QueueVO();
        content.setName(body);
        content.setAge(18);
        producer.sendMessage("queue-1", "test", content);
        return "ok";
    }
}
